package logic

import (
	"context"
	"housing/houserpc/houserpc"

	"housing/api/internal/svc"
	"housing/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type HouseShowSmsLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewHouseShowSmsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *HouseShowSmsLogic {
	return &HouseShowSmsLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *HouseShowSmsLogic) HouseShowSms(req *types.HouseShowRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	show, err := l.svcCtx.HouseRpc.HouseShow(l.ctx, &houserpc.HouseShowRequest{
		HouseId: req.HouseId,
	})
	if err != nil {
		return &types.Response{
			Message: err.Error(),
			Code:    500,
			Data:    nil,
		}, nil
	} else {
		return &types.Response{
			Message: "房源详情展示成功",
			Code:    200,
			Data:    show,
		}, nil
	}
}
